<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var source = {
            name: 'm',
            height: 165
        }
        var objnew = Object.assign({
            weight: '45kg'
        }, source)
        console.log(objnew)
            // 对象扩展运算符
        var car = {...objnew,
            price: 100
        }
        console.log(car)

        var arr = [1, 2, 3]
        var newarr = [...arr, 6, 7, 8]
        console.log(newarr)


        // promise
        var promise = new Promise((resolve, reject) => {
            setTimeout(() => {
                console.log('你好')
                resolve();
            }, 1000);
        })


        // promise 执行
        promise.then(res => {
            console.log("下一步")
            promise.then(res => {
                console.log("完成")
            })
        })

        // 链式调用
        function fn1() {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    console.log('第一步')
                        // promise 传参

                    resolve(res);
                }, 1000);
            })
        }

        function fn2() {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    console.log('第二步')
                    resolve();
                }, 1000);
            })
        }
        fn1().then(res => {
            console.log(res)
            return fn2()
        }).then(res => {
            return fn1()
        }).then(res => {
            return fn2()
        }).then(res => {
            console.log("完成")
        })


        // promise 传参
    </script>
</body>

</html>